<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserLevelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_levels', function (Blueprint $table) {
            $table->id()->comment('用户等级记录表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('merchant_id')->index()->comment('商户id');
            $table->integer('level_id')->comment('等级VIP');
            $table->integer('grade')->comment('会员等级');
            $table->timestamp('valid_time')->comment('过期时间');
            $table->string('mark')->comment('备注');
            $table->decimal('discount',8,2)->comment('享受折扣');
            $table->tinyInteger('remind')->comment('是否已通知 0否 1是');
            $table->tinyInteger('is_forever')->comment('是否永久 0否 1是');
            $table->tinyInteger('status')->default(1)->comment('状态 0:禁止 1:正常');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_levels');
    }
}
